package com.ruoyi.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.domain.TModelcamgroup;
import com.ruoyi.service.ITModelcamgroupService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 摄像头分组Controller
 * 
 * @author li
 * @date 2025-09-05
 */
@RestController
@RequestMapping("/system/modelcamgroup")
public class TModelcamgroupController extends BaseController
{
    @Autowired
    private ITModelcamgroupService tModelcamgroupService;

    /**
     * 查询摄像头分组列表
     */
    @PreAuthorize("@ss.hasPermi('system:modelcamgroup:list')")
    @GetMapping("/list")
    public TableDataInfo list(TModelcamgroup tModelcamgroup)
    {
        startPage();
        List<TModelcamgroup> list = tModelcamgroupService.selectTModelcamgroupList(tModelcamgroup);
        return getDataTable(list);
    }

    /**
     * 导出摄像头分组列表
     */
    @PreAuthorize("@ss.hasPermi('system:modelcamgroup:export')")
    @Log(title = "摄像头分组", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TModelcamgroup tModelcamgroup)
    {
        List<TModelcamgroup> list = tModelcamgroupService.selectTModelcamgroupList(tModelcamgroup);
        ExcelUtil<TModelcamgroup> util = new ExcelUtil<TModelcamgroup>(TModelcamgroup.class);
        util.exportExcel(response, list, "摄像头分组数据");
    }

    /**
     * 获取摄像头分组详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:modelcamgroup:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(tModelcamgroupService.selectTModelcamgroupById(id));
    }

    /**
     * 新增摄像头分组
     */
    @PreAuthorize("@ss.hasPermi('system:modelcamgroup:add')")
    @Log(title = "摄像头分组", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TModelcamgroup tModelcamgroup)
    {
        return toAjax(tModelcamgroupService.insertTModelcamgroup(tModelcamgroup));
    }

    /**
     * 修改摄像头分组
     */
    @PreAuthorize("@ss.hasPermi('system:modelcamgroup:edit')")
    @Log(title = "摄像头分组", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TModelcamgroup tModelcamgroup)
    {
        return toAjax(tModelcamgroupService.updateTModelcamgroup(tModelcamgroup));
    }

    /**
     * 删除摄像头分组
     */
    @PreAuthorize("@ss.hasPermi('system:modelcamgroup:remove')")
    @Log(title = "摄像头分组", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(tModelcamgroupService.deleteTModelcamgroupByIds(ids));
    }
}
